//k1 edit 22.2.25

private ["_center","_rotation","_obj","_staticWeaponClasses","_parkedVehicleClasses"];
_center = param[0];
_rotation = param[1];

_staticWeaponClasses = if(count _this > 2)then [{_this select 2},{[]}];
_parkedVehicleClasses = if(count _this > 3)then[{_this select 3},{[]}];

if (isNil "a3e_var_artillery_units") then {a3e_var_artillery_units = []};

[_center,30] call a3e_fnc_cleanupTerrain; //清除半径内场地

_fnc_createObject = {
    params ["_className","_centerPos","_relativePos","_rotateDir","_relativeDir"];
    private ["_object", "_realPos", "_realDir"];

    _fnc_rotatePos = {
        private ["_centerPos", "_pos", "_dir"];
        private ["_px", "_py", "_mpx", "_mpy", "_ma", "_rpx", "_rpy"];
        _centerPos = _this select 0;
        _pos = _this select 1;
        _dir = _this select 2;
        _px = _pos select 0;
        _py = _pos select 1;
        _mpx = _centerPos select 0;
        _mpy = _centerPos select 1;
        _ma = _dir;
        _rpx = ( (_px - _mpx) * cos(_ma) ) + ( (_py - _mpy) * sin(_ma) ) + _mpx;
        _rpy = (-(_px - _mpx) * sin(_ma) ) + ( (_py - _mpy) * cos(_ma) ) + _mpy;
        [_rpx, _rpy, (_pos select 2)];
    };

    _realPos = ([_centerPos, [(_centerPos select 0) + (_relativePos select 0), (_centerPos select 1) + (_relativePos select 1),(_relativePos select 2)], _rotateDir] call _fnc_rotatePos);
    _object = createVehicle [_className, _realPos, [], 0, "CAN_COLLIDE"];
    _object setdir (_relativeDir + _rotateDir);
    _object setPosATL _realPos;
    _object
};

_obj = ['Land_LampAirport_F',_center,[-15,14.3,0],_rotation,90] call _fnc_createObject;
_obj = ['Land_Communication_F',_center,[-11.2,-2.7,12.3],_rotation,0] call _fnc_createObject;
_obj = ['Land_LampAirport_F',_center,[15.3,-17.2,0],_rotation,270] call _fnc_createObject;
_obj = ['Land_BagBunker_Small_F',_center,[5.9,-11.6,0],_rotation,0] call _fnc_createObject;
_obj = ['Land_Sign_WarningMilAreaSmall_F',_center,[7.3,-13.2,0.3],_rotation,0] call _fnc_createObject;
_obj = ['Land_PierLadder_F',_center,[5.5,2,16],_rotation,270] call _fnc_createObject;
_obj = ['Land_Offices_01_V1_F',_center,[1.8,-0.9,0],_rotation,0] call _fnc_createObject;
_obj = ['Reflector_Cone_01_narrow_red_F',_center,[-11.2,-2.7,43.5],_rotation,0] call _fnc_createObject;
_obj = ['FlagPole_F',_center,[3,-13.7,0],_rotation,270] call _fnc_createObject;
_obj setFlagTexture A3E_VAR_Flag_Opfor;

_obj = ['Land_DataTerminal_01_F',_center,[-9.7,-2.2,18],_rotation,180] call _fnc_createObject;
_obj setVariable ["A3E_isTerminal",true,true];
_obj allowDamage false;
[_obj,"green","green","green"] call BIS_fnc_DataTerminalColor;
//防止因地形相对位置陷到楼里
_obj spawn {waitUntil {!isNil "DR_fn_setPosAGLS"}; [_this,getPosASL _this] call DR_fn_setPosAGLS}; //

_obj = ['Box_East_WpsLaunch_F',_center,[11.5,0,0.9],_rotation,360] call _fnc_createObject;
_obj allowDamage false;
_obj = ['Box_East_Ammo_F',_center,[10.3,0.8,0.9],_rotation,180] call _fnc_createObject;
_obj allowDamage false;
_obj = ['Box_East_WpsSpecial_F',_center,[10.3,2.5,0.9],_rotation,270] call _fnc_createObject;
_obj allowDamage false;

//固定武器
_MGGMH = a3e_arr_Escape_SWC_MG_H + a3e_arr_Escape_SWC_GM_H;
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[-7.5,6.3,1],_rotation,3] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[-13.5,6,18],_rotation,315] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[13.3,-7.2,18],_rotation,135] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[5.8,-12,0],_rotation,180] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[7,-7,8.8],_rotation,180] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[2,-7,1],_rotation,180] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[2,6.3,1],_rotation,3] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[12.2,-6.8,12.6],_rotation,180] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[7.5,6.3,1],_rotation,3] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];

_MGA = a3e_arr_Escape_SWC_MG_A;
_gun = selectRandom _MGA;
_obj = [_gun,_center,[-10.5,6,18],_rotation,103] call _fnc_createObject;
Escape_allStatics pushback _obj;
_gun = selectRandom _MGA;
_obj = [_gun,_center,[1.3,-2.8,1],_rotation,120] call _fnc_createObject;
Escape_allStatics pushback _obj;
_gun = selectRandom _MGA;
_obj = [_gun,_center,[8.5,3.8,1],_rotation,280] call _fnc_createObject;
Escape_allStatics pushback _obj;
_gun = selectRandom _MGA;
_obj = [_gun,_center,[13.2,6.2,1],_rotation,197] call _fnc_createObject;
Escape_allStatics pushback _obj;
_gun = selectRandom _MGA;
_obj = [_gun,_center,[8.2,2.1,5],_rotation,214] call _fnc_createObject;
Escape_allStatics pushback _obj;

_gun = selectRandom a3e_arr_MortarSite;
_obj = [_gun,_center,[-6.5,-0.3,18],_rotation,180] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
a3e_var_artillery_units pushBack _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom a3e_arr_MortarSite;
_obj = [_gun,_center,[5,-5.3,18],_rotation,0] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
a3e_var_artillery_units pushBack _obj;
_obj setVariable ["Escape_assets_control", true, true];

_obj = ['B_AAA_System_01_F',_center,[-13.2,-10.2,18],_rotation,180] call _fnc_createObject; //
_obj setMass 99999;
createVehicleCrew _obj;
if (side _obj != A3E_VAR_Side_Opfor) then {_grp = createGroup [A3E_VAR_Side_Opfor, true]; (units _obj) joinSilent _grp};
_obj addWeaponGlobal "Gatling_30mm_Plane_CAS_01_F";
_obj addMagazineGlobal "1000Rnd_Gatling_30mm_Plane_CAS_01_F";
_obj addMagazineGlobal "1000Rnd_Gatling_30mm_Plane_CAS_01_F";
_obj addMagazineGlobal "1000Rnd_Gatling_30mm_Plane_CAS_01_F";
_obj addMagazineGlobal "1000Rnd_Gatling_30mm_Plane_CAS_01_F";
_obj addMagazineGlobal "1000Rnd_Gatling_30mm_Plane_CAS_01_F";
_obj = ['B_AAA_System_01_F',_center,[12.3,5.3,18],_rotation,0] call _fnc_createObject; //
_obj setMass 99999;
createVehicleCrew _obj;
if (side _obj != A3E_VAR_Side_Opfor) then {_grp = createGroup [A3E_VAR_Side_Opfor, true]; (units _obj) joinSilent _grp};
_obj addWeaponGlobal "Gatling_30mm_Plane_CAS_01_F";
_obj addMagazineGlobal "1000Rnd_Gatling_30mm_Plane_CAS_01_F";
_obj addMagazineGlobal "1000Rnd_Gatling_30mm_Plane_CAS_01_F";
_obj addMagazineGlobal "1000Rnd_Gatling_30mm_Plane_CAS_01_F";
_obj addMagazineGlobal "1000Rnd_Gatling_30mm_Plane_CAS_01_F";
_obj addMagazineGlobal "1000Rnd_Gatling_30mm_Plane_CAS_01_F";
_obj = ['B_SAM_System_01_F',_center,[-0.2,-0.3,18],_rotation,0] call _fnc_createObject;
_obj setMass 99999;
createVehicleCrew _obj;
if (side _obj != A3E_VAR_Side_Opfor) then {_grp = createGroup [A3E_VAR_Side_Opfor, true]; (units _obj) joinSilent _grp};

//veh
_parkedVehicleClasses append ["C_Heli_Light_01_civil_F","B_Heli_Light_01_F","I_Heli_light_03_unarmed_F"]; //
_veh = selectRandom _parkedVehicleClasses;
_obj = [_veh,_center,[-20.5,-7,0],_rotation,180] call _fnc_createObject;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_veh = selectRandom _parkedVehicleClasses;
_obj = [_veh,_center,[20.5,-2.7,0],_rotation,180] call _fnc_createObject;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];

Escape_campType_arr pushback [_center,'信号站','k1'];
publicVariable 'Escape_campType_arr';


